package main.java.com.waylau.netty.demo.privateprotocol.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.handler.timeout.ReadTimeoutHandler;

/**
 * 去掉了 证书 验证
 */
public class NettyServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    public void initChannel(SocketChannel ch) throws Exception {
	ChannelPipeline pipeline = ch.pipeline();
	pipeline.addLast("lifeCycleManage",new MyOutboundHandler());
	pipeline.addLast("decoder", new StringDecoder());
	pipeline.addLast("encoder", new StringEncoder());
	// 超时无响应就断开连接
	pipeline.addLast("readTimeoutHandler", new ReadTimeoutHandler(50));
	pipeline.addLast(new LoginAuthRespHandler());//认证吧
	pipeline.addLast("HeartBeatHandler", new HeartBeatRespHandler());
	pipeline.addLast("chatHandler",new ChatHandler());
    }


}
